import { Maze, Room, Direction, Wall, Door } from '../common'

class MazeGameFM {
    createMaze(): Maze {
        const maze = this.MakeMaze()
        const r1 = this.MakeRoom(0)
        const r2 = this.MakeRoom(1)

        const d = this.MakeDoor(r1, r2)

        maze.addRoom(r1)
        maze.addRoom(r2)

        r1.setSide(Direction.North, this.MakeWall())
        r1.setSide(Direction.East, d)
        r1.setSide(Direction.South, this.MakeWall())
        r1.setSide(Direction.West, this.MakeWall())


        r2.setSide(Direction.North, this.MakeWall())
        r2.setSide(Direction.East, this.MakeWall())
        r2.setSide(Direction.South, this.MakeWall())
        r2.setSide(Direction.West, d)
        return maze
    }

    MakeMaze(): Maze {
        return new Maze()
    }
    MakeRoom(n: number): Room {
        return new Room(n)
    }
    MakeWall(): Wall {
        return new Wall()
    }
    MakeDoor(r1: Room, r2: Room): Door {
        return new Door(r1, r2)
    }
}